#!/bin/sh

# Debian: apt-get install python3 python3-pip python3-venv

# Step 1. Prepare Python virtual enviroenmtn
if [ ! -d ".venv" ]; then
    # Step 1. Create Virtual Environemnt
    python3 -m venv .venv
    # Step 2. Activate
    source ./.venv/bin/activate
    # Step 2. Update core Python modules
    python3 -m pip install -U pip
    python3 -m pip install -U setuptools
    python3 -m pip install -U wheel
    # Step 3. Update product dependencies
    python3 -m pip install -e .
else
    # Step 1. Activate
    source ./.venv/bin/activate
fi

# Step 2. Run Habr article parser
python3 -m habraparse save_post 750270 --output articles/750270.pdf --raw articles/750270.html
python3 -m habraparse save_post 750608 --output articles/750608.pdf
python3 -m habraparse save_post 750794 --output articles/750794.pdf
python3 -m habraparse save_post 752132
python3 -m habraparse save_post 751002
python3 -m habraparse save_post 751060
